 /*
  *@(#)SpiderCtl.java		8 Sept. 2000
  *
  * Copyright: MetaPlus Inc & Inquiry Management Systems Ltd.  2000
  *
  * This software is the proprietary information of MetaPlus Inc & 
  * Inquiry Management Systems Ltd.  
  * Use is subject to license terms.
  */
package com.ims.iaa;

import java.rmi.Remote;
import java.rmi.RemoteException;

/**
  * The remote interface for the Spider Control Center which centrally control 
  * ad search spiders ( <code>AdSpider</code> objects ).
  * The center is used to regiseter, remove spiders and dispatch request 
  * to spiders.
  *
  * @author Anthony Zhang
  *
  * @version 1.00, 25 Sept. 2000
  *
  */
public interface SpiderCtl extends Remote {
  
  /** 
    *  Registers a free AdSpider to the Spider Control Center
    *
    *  @param adSpider The AdSpider which is free to proecess ad track request.
	* 
	*  @return void
	*
	*  @see SpiderCtlImpl#registerAdSpider
    */
  public void registerAdSpider( AdSpider adSpider) 
	throws RemoteException;

  /** 
    *  Removes a busy AdSpider from the Spider Control Center
    *
    *  @param adSpider The AdSpider which is assign with ad track request and become busy. 
	* 
	*  @return void
	*
	*  @see SpiderCtlImpl#removeAdSpider
    */
  public void removeAdSpider( AdSpider adSpider) 
	throws RemoteException;
	
  /**
    *  Determine whether the Spider Control Center has free spiders or not
	*
    *  @return True if there are free spiders, or false if not
    * 
    *  @see SpiderCtlImpl#isReady
	*/	
  public boolean isReady()
   	throws RemoteException;
  
  /**
    *  Inform the Spider Control Center to give the specified request to 
	*  one of its free spider to process.
	*
	*  @return Flag indicates whether the request was successfully dispatched
	* 	to a spider or not.
	*
	*  @params adRequest  The ad search request which needed to be processed
	*
	*  @see SpiderCtlImpl#processRequest
	*/
  public boolean processRequest(AdTrackRequest adRequest)
	throws RemoteException;
  
  /**
   * Register a client machine in Spider Control Center, 
   * and get the current registered index which register by the same machine.
   * @param sMachineName
   * @return the register index.
	*  @see SpiderCtlImpl#registerClient
   */
  public int registerClient(String sMachineName) throws RemoteException;
}